home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5334 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: castle.nando.net!news
  2. From: actuary@nando.net   (Bill McCarthy)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Q: pointers to pointers that point to structs?
  5. Date: 10 Feb 1996 07:51:07 GMT
  6. Organization: News & Observer Public Access
  7. Message-ID: <4fhipb$eg2@castle.nando.net>
  8. References: <311C1B4E.217F@mars.superlink.net>
  9. Reply-To: actuary@nando.net (Bill McCarthy)
  10. NNTP-Posting-Host: grail1319.nando.net
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12.  
  13. In <311C1B4E.217F@mars.superlink.net>, Michael Rizzo <rizzom@mars.superlink.net> writes:
  14. >
  15. >  I am having trouble dereferencing a pointer to a pointer to a struct.
  16. >For simplicity just say the struct is:
  17. >struct test
  18. >  {
  19. >  char teststr[10];
  20. >  int  testint;
  21. >  }
  22.  
  23. Replace above with: };
  24.  
  25. >
  26. >Now I have a function that just wants to print elements of the 
  27. >structure:
  28. >
  29. >void f(test **temp)
  30.  
  31. Replace above with: void f( struct test **temp )
  32.  
  33. >{
  34. >printf("%s  %d",(please fill in the blank))
  35.  
  36. Here are two approaches:
  37.    printf( "%s  %d",(*temp)->teststr, (**temp).testint );
  38.  
  39. >}
  40.  
  41.  
  42. Bill McCarthy
  43. actuary@nando.net
  44. Wendell, NC  USA
  45.  
  46.